<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${message("警报列表")}</title>
<link href="/resources/css/common.css" rel="stylesheet" type="text/css" />
<link href="/resources/css/zTreeStyle.css" rel="stylesheet" type="text/css">
<link href="/resources/css/layout.css" rel="stylesheet" type="text/css" />
<link href="/resources/css/mmGrid.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/resources/js/reference/jquery.js"></script>
<script type="text/javascript" src="/resources/js/base/dialog.js"></script>
<script type="text/javascript" src="/resources/js/reference/jquery.validate.js"></script>
<script type="text/javascript" src="/resources/js/base/request.js"></script>
<script type="text/javascript" src="/resources/js/base/global.js"></script>
<script type="text/javascript" src="/resources/js/reference/mmGrid.js"></script>
<script type="text/javascript" src="/resources/plugin/datePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/resources/js/reference/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript">
function edit(id){
	parent.change_tab(0,'edit.jhtml?id='+id+'&isCheck=${isCheck}');
}
$().ready(function() {
	var $buildForm = $("#buildForm");
	
	var isProcesss= {0:'${message("未处理")}',1:'${message("已处理")}'};
	var cols = [
	            
		{ title:'${message("操作")}', align:'center', width:60, renderer:function(val,item){
			if(item.is_process==0){
				return '<input type="hidden" value="'+item.id+'"><a href="javascript:;" class="handleWarm btn-edit">处理</a>';
			}
		}},
		{ title:'${message("终端设备编号")}', name:'terminal_num' ,align:'center',renderer:function(val,item,rowIndex){
// 			return '<a href="javascript:void(0);" onClick="edit('+item.id+')" class="red">'+val+'</a>';
			return val;
		}},
		
		{ title:'车辆信息' ,align: 'center', cols: [
			{ title:'${message("车牌号")}', name:'car_number' ,isLines:true,align:'center' },
			{ title:'${message("锁编号")}', name:'elock_num' ,isLines:true,align:'center',renderer:function(val,item,rowIndex){
// 			return '<a href="javascript:void(0);" onClick="edit('+item.id+')" class="red">'+val+'</a>';
				return val;
			}},
			{ title:'${message("舱位")}', name:'position' ,isLines:true,width:60,align:'center',renderer:function(val,item,rowIndex){
				var berth=item.berth;
				var position=item.position;
				return (berth==null?'':berth)+','+(position==null?'':position);
			}},
		]},
			{ title:'${message("报警信息")}' ,isLines:true, cols: [
			{ title:'${message("报警信息")}', name:'warning_message' ,isLines:true,width:310,align:'center' },
			{ title:'${message("报警发生时间")}', name:'warning_time' ,width:120,isLines:true,align:'center' },
			{ title:'${message("经度")}', name:'longitude' ,isLines:true,align:'center' },
			{ title:'${message("纬度")}', name:'latitude' ,isLines:true,align:'center', },
			{ title:'${message("是否处理")}', name:'is_process' ,isLines:true,align:'center',renderer:function(val,item,rowIndex){
				return isProcesss[val];
			} },
			{ title:'${message("处理人")}', name:'processor' ,isLines:true,align:'center', },
			{ title:'${message("处理时间")}', name:'process_time' ,width:120,isLines:true,align:'center', },
			//{ title:'${message("版本号")}', name:'version' ,isLines:true,align:'center', },
			{ title:'${message("备注")}', name:'remark' ,isLines:true,align:'center', },
		]},
		
	];
	$mmGrid = $('#table-m1').mmGrid({
		autoLoad:true,
        cols: cols,
        fullWidthRows:true,
        url: 'list_data.jhtml',
        params:function(){
        	return $("#listForm").serializeObject();
        },
		plugins : [
            $('#paginator').mmPaginator()
        ]
    });
    
    // 处理
    $(".handleWarm").live("click", function() {
	    var id = $(this).prev().val();
    	$.message_confirm('您确定要处理该报警信息吗？',function(){
			$.ajax({
				url: "/warning_message_process/handle.jhtml",
				type: "POST",
				data: {ids: id},
				dataType: "json",
				cache: false,
				success: function(resultMsg) {
					$.message_timer(resultMsg.type,resultMsg.content,1000,function(){
						location.reload(true);
					});
				}
			});
		})
    });
});

function handle(e){
	var data =$mmGrid.serializeSelectedIds();
	if(data.length==0){
		$.message_alert("${message("请选择需要处理的报警信息")}");
		return false;
	}
	ajaxSubmit(e,{
		url:"/warning_message_process/handle.jhtml",
		method:"post",
		data:data,
		isConfirm:true,
		confirmText : '您确定要处理已勾选的报警信息吗？',
		callback:function(resultMsg){
			$.message_timer(resultMsg.type,resultMsg.content,1000,function(){
				$mmGrid.load();
			});
		}
	});
}
</script>
<script type="text/javascript">
$().ready(function(e) {
 	var zTree = $("#js-menu").initTree({
		url:"/saleOrg/getNodes.jhtml",
		onClick:function(e,treeId, treeNode) {
			$("#saleOrgId").val(treeNode.id);
		    if(treeNode.id==""){
		  		$("#saleOrgName").val("");
		    }else{
		  		$("#saleOrgName").val(treeNode.name);
		    }
		    $("#searchBtn").click();
		}
	})
    zTree.addNodes(null,{'id':'','pId':'','name':'全部机构','isParent':false});
}); 
</script>
</head>
<body>
<!--<div class="subnav">
	<input type="hidden" id="flag" value="0">
	<input type="hidden" id="storeId" value="">
 	<div class="tit"><s></s>机构分类</div>
  	<div class="subn-list ztree" id="js-menu">
  	</div>
</div>
<div class="main-right">
-->
	<form id="listForm" action="list.jhtml" method="get">
		<div class="bar">
			<div class="buttonWrap">
			<a href="javascript:void(0);" class="iconButton" id="shengheButton" onclick="handle(this)">
				<span class="ico-shengheIcon">&nbsp;</span>${message("勾选处理")}
			</a>
			<!--
			<div class="flag-wrap flagImp-wrap">
					<a href="javascript:void(0);" class="iconButton" id="export1Button">
						<span class="impIcon">&nbsp;</span>导入导出
					</a>
					<ul class="flag-list">
						<li><a href="javascript:void(0)" onclick="member_import(this)"><i class="flag-imp01"></i>${message("导入")}</a></li>
						<li><a href="javascript:void(0)" onclick="exportExcel(this)"><i class="flag-imp02"></i>${message("选择导出")}</a></li>
						<li><a href="javascript:void(0)" onclick="segmentedExport(this)"><i class="flag-imp02"></i>${message("条件导出")}</a></li>
					</ul>
				</div>
			-->
		</div>
		<div class="search-btn">
			<a href="javascript:;" id="searchBtn" class="iconButton">${message("1004")}</a>
		</div>
		<div id="searchDiv">
			 <div id="search-content" >
			 	<!--
			 	<dl>
					<dt><p>${message("机构名称")}:</p></dt>
					<dd>
						<input type="hidden" id="saleOrgId" name="saleOrgId"  class="text" value="" />
						<input type="text"  class="text" id="saleOrgName" value="" readyOnly/>
					</dd>
				</dl>
				-->
			 	
        		<dl>
    				<dt ><p>终端设备编号:</p></dt>
	    			<dd >
	    				<input type="text" class="text" id="sn" name="terminalNum"  btn-fun="clear"/>
	    			</dd>
	    		</dl>
	    		<dl>
    				<dt ><p>锁编号:</p></dt>
	    			<dd >
	    				<input type="text" class="text" id="sn" name="elockNum"  btn-fun="clear"/>
	    			</dd>
	    		</dl>
	    		<!--<dl>
				 <dt ><p>车牌号:</p></dt>
    			<dd >
    				<input type="text" class="text" id="carNumber" name="carNumber"  btn-fun="clear"/>
    			</dd>
	    		</dl>
	    		<dl>
	    			<dt><p>备注:</p></dt>
	    			<dd>
	    				<input type="text" class="text" id="remark" name="remark"  btn-fun="clear"/>
	    			</dd>
	    		</dl> -->
	    		<!--
	    		<dl>
        			<dt><p>${message("16015")}:</p></dt>
        			<dd class="date-wrap">
						<input id="startTime" name="startTime" class="text" value="" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd',startDate:'%y-%M-%d', maxDate: '#F{$dp.$D(\'endTime\')}'});" type="text" btn-fun="clear"/>
						<div class="fl">--</div>
						<input id="endTime" name="endTime" class="text" value="" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd',startDate:'%y-%M-%d', maxDate: '#F{$dp.$D(\'endTime\')}'});" type="text" btn-fun="clear"/>
					</dd>
        		</dl>
        		-->
        	</div>
		</div>
		</div>
		<!--</div>-->
		<div class="table-responsive">
			<table id="table-m1"></table>
	    	<div id="body-paginator" style="text-align:left;">
	    		<div id="paginator"></div>
	   		</div>
		</div>
	</form>
</body>
</html>